package ch06.ith_3;

import java.util.Calendar;

public class CalenderDemo {


    public static void main(String[] args) {
        /*
         * static Calendar getInstance()
         * 使用默认时区和语言环境获得一个日历
         * */
        Calendar c = Calendar.getInstance();

        /*
         * 常用方法：
         * public int get(int field) 返回给定日历字段的值
         * YEAR 年
         * MONTH 月（从 0 开始，用的时候加 1 ）
         * DAY——OF——MONTH  月 中 的 天
         * HOUR 时
         * MINUTE 分
         * SECOND 秒
         * */
      /*  int year = c.get(Calendar.YEAR);
        System.out.println(year);
        System.out.println("___________");
        c.set(Calendar.YEAR,9999);
        int year1 = c.get(Calendar.YEAR);
        System.out.println(year1);
        System.out.println("___________");
        int month= c.get(Calendar.MONTH);
        System.out.println(month+1);

        System.out.println("___________");*/
     /*   c.set(Calendar.MONTH,10);
        int month2 = c.get(Calendar.MONTH);
        System.out.println(month2);
        System.out.println("------------");*/
      /*  int month = c.get(Calendar.MONTH);
        System.out.println(month+1);
        int day = c.get(Calendar.DAY_OF_MONTH);
        System.out.println(day);
        int hour = c.get(Calendar.HOUR);
        System.out.println(hour);
        int minute = c.get(Calendar.MINUTE);
        System.out.println(minute);
        int second = c.get(Calendar.SECOND);
        System.out.println(second);
        System.out.println("----------");*/

        demo02();
    }
    public static void demo02(){
        Calendar c= Calendar.getInstance();
        c.clear();
        c.set(Calendar.DAY_OF_MONTH,4);
       // int month = c.get(Calendar.DAY_OF_MONTH);
        int date = c.get(Calendar.DAY_OF_MONTH);
        System.out.println(date);
        System.out.println();
    }
}
